Skip to content

Add geometric filtering for CEP stimuli#579

Open
samibismar wants to merge 4 commits into
SimVascular:mainfrom
samibismar:feature-cep-spatial-stimulus
Open

Add geometric filtering for CEP stimuli#579
samibismar wants to merge 4 commits into
SimVascular:mainfrom
samibismar:feature-cep-spatial-stimulus

Conversation

@samibismar

Copy link
Copy Markdown

Current situation

Related to #572.

This PR adds optional geometric filtering for CEP applied stimuli. A CEP stimulus can now be restricted using an axis-aligned box, a sphere, or both together.

When both box and sphere bounds are provided, the stimulus is applied only to nodes that satisfy both geometric restrictions, while still respecting the parent domain.

This PR also incorporates review feedback by grouping the new XML parameters under Spatial_bounds and refactoring the stimulus-specific logic into stimType.

Release Notes

  • Added optional spatial bounds for CEP stimuli:

    • Spatial_bounds / Box / Minimum
    • Spatial_bounds / Box / Maximum
    • Spatial_bounds / Sphere / Center
    • Spatial_bounds / Sphere / Radius
  • Box and sphere bounds can be used independently or together.

  • When box and sphere bounds are both provided, the applied stimulus region is their intersection.

  • Refactored CEP stimulus evaluation so temporal activation, spatial filtering, and MPI distribution are handled by stimType.

  • Replaced feature-related error paths with the svMultiPhysics exception infrastructure.

Example:

<Stimulus type="Istim" >
  <Amplitude> -35.714 </Amplitude>
  <Start_time> 0.0 </Start_time>
  <Duration> 2.0 </Duration>
  <Cycle_length> 10000.0 </Cycle_length>

  <Spatial_bounds>
    <Box>
      <Minimum> 0.20 0.20 0.20 </Minimum>
      <Maximum> 1.00 1.00 1.00 </Maximum>
    </Box>

    <Sphere>
      <Center> 0.55 0.75 0.75 </Center>
      <Radius> 0.50 </Radius>
    </Sphere>
  </Spatial_bounds>
</Stimulus>

Documentation

The new XML structure is documented in the StimulusParameters example in Parameters.h.

Testing

Successfully compiled on macOS.

Validated using a Niederer benchmark CEP case with several stimulus configurations:

  • no stimulus
  • no spatial bounds
  • box-only bounds
  • sphere-only bounds
  • overlapping box+sphere bounds
  • disjoint box+sphere bounds
  • impossible box/sphere bounds

The expected logical comparisons passed in serial and with MPI using 2 processes. In particular, the disjoint box+sphere and impossible-bound cases matched the no-stimulus case, while valid bounded cases differed from the unbounded stimulus case.

Also ran a visual validation using a spherical stimulus with 4 MPI processes and confirmed that the activation was localized and propagated as expected.

Code of Conduct & Contributing Guidelines

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant